package edu.iss.demo.web.validator;

import java.util.Set;

import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import javax.validation.metadata.BeanDescriptor;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;

import edu.iss.demo.model.Employee;


public class LoginValidator implements org.springframework.validation.Validator
{

	@Override
	public boolean supports(Class<?> clazz) {
		return Employee.class.isAssignableFrom(clazz);
	}

	@Override
	public void validate(Object target, Errors errors) {
		Employee emp = (Employee) target;
		ValidationUtils.rejectIfEmpty(errors, "employeeId", "emp.employeeId.empty");
		ValidationUtils.rejectIfEmpty(errors, "password", "emp.password.empty");
	}
}
